home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 2000
/
MacHack 2000.toast
/
pc
/
The Hacks
/
Softshoe
/
Lisa's Mac Parts
/
Printing
/
PrintBatch.cp
< prev
next >
Wrap
Text File
|
2000-06-23
|
1KB
|
59 lines
// PrintBatch.cp
#ifndef PrintBatch_h
#include "PrintBatch.h"
#endif
#ifndef PrintingError_h
#include "PrintingError.h"
#endif
#ifndef PrintJob_h
#include "PrintJob.h"
#endif
bool PrintBatch::batchExists = false;
PrintBatch::PrintBatch( const PrintJob& theJob )
: job( theJob ),
started( false )
{
Assert( !batchExists );
batchExists = true;
}
PrintBatch::~PrintBatch()
{
if ( started )
{
PrCloseDoc( &port );
DebugOSError( PrError() );
}
Assert( batchExists );
batchExists = false;
}
void PrintBatch::Start()
{
Assert( !started );
TPPrPort returned = PrOpenDoc( job.PrintHandle(), &port, buffer );
ThrowPrintingError( PrError() );
Assert( returned == &port );
started = true;
}
void PrintBatch::End()
{
Assert( started );
started = false;
PrCloseDoc( &port );
ThrowPrintingError( PrError() );
if ( job.Spooled() )
{
TPrStatus status;
PrPicFile( job.PrintHandle(), &port, buffer, 0, &status );
ThrowPrintingError( PrError() );
}
}